//判断是否有做出选择
function isSelect(grid){
	var rows = grid.datagrid('getSelections');
	if (rows.length <1) {
		$.messager.alert('警告', "请至少选择一项记录进行操作!", 'warning');
		return false;
	} else {
		return true;
	}
}
//判断是否选择一条记录。true为是，false为否
function isSingleSelect(grid) {
	var rows = grid.datagrid('getSelections');
	if (rows.length > 1) {
		$.messager.alert('警告', "只能选择一项记录进行操作!", 'warning');
		return false;
	} else {
		return true;
	}
}

//取得单选记录
function getSingleSelected(grid){
	var rows = grid.datagrid('getSelections');
	if (rows.length == 1)
		return rows[0]; 
	else if(rows.length>1){
		$.messager.alert('警告', "只能选择一项记录进行操作!", 'warning');
		return false;
	}
	else {
		$.messager.alert('警告', "请至少选择一项记录进行操作!", 'warning');
		return false;
	}
}

//取得所选择的id串
function getSelections(grid) {
	var ids = [];
	var rows = grid.datagrid('getSelections');
	for ( var i = 0; i < rows.length; i++) {
		ids.push(rows[i].id);
	}
	return ids.join(',');
}